@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
    display: flex;
    margin: 0;
    height: 100vh;
    align-items: center;
    justify-content: center;
    background-color: #7a5df8;
    overflow: hidden;

}
* {
    box-sizing: border-box;
}


.content {
    position: relative;
    height: 50px;
}

.content input {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    padding-left: 10px;
    border: 0;
    line-height: 50px;
    transition:  width .3s ease;
}

.content input:focus {
    outline: none;
}


.btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    border: 0;
    font-size: 24px;
    cursor: pointer;
    background-color: #fff;
    transition: transform 0.3s ease;
}

.fa-search:before {
    content: "\f002";
}

/* 移动效果实现，输入框从原先的50px变成200px，btn通过translateX在水平方向上进行位移 */
.content.active input {
    width: 200px;
}

.content.active .btn {
    transform: translateX(200px);
}